package bricolot.importer;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import bricolot.Societe;

public class BricolotoDomImporter extends AXmlImporter {

	protected Societe mSociete;

	public BricolotoDomImporter(Societe aSociete) {
		super();
		this.mSociete = aSociete;
	}

	@Override
	public Object loadContentsOf(String aFileName) {
		if (this.importFile(aFileName)) {

			NodeList nodeList = this.mRootNode.getChildNodes();
			Node currentNode;
			for (int i = 0; i < nodeList.getLength(); i++) {
				currentNode = nodeList.item(i);
				System.out.println("Type: " + currentNode.getNodeType());
				System.out.println("Name :" + currentNode.getNodeName());
				System.out.println("Value: " + currentNode.getNodeValue());
				System.out.println("Contents: " + currentNode.getTextContent());
				System.out.println("-");
			}
			return this.mSociete;
		} else
			return null;
	}

}
